<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/15
 * Time: 10:22
 */

namespace app\controller;
use rap\config\Config;
use rap\web\Request;
use app\server\request as requestModel;

class PayInfoController {

    public function getPaymentAmount (Request $request) {

        if ($request->method() == "POST") {

        }
    }
    /**
     * (获取统一订单号
     * @param Request $request
     * @return array
     */
    public function getOrderNumber (Request $request) {
       if ($request->method() == "POST") {

           $config = new Config();

           $data = $config->getFileConfig();


           $url = $data['payUrl']['url'];
           $trade_no = md5(uniqid(time()));
           $where = [
               'trade_no' => $trade_no,
               'callback' => 'http://www.baidu.com',
               'amount' => 0.01,
               'title' => '违章代缴',
               'user_id' => 3105,
               'des' => '违章代缴扣款',
               'remark' => '测试下单',
               'secret' =>  $data['app_info']['app_secret'],
           ];

           $data = requestModel::getMethod($url, $where);
            $data['data']['trade_no'] = $trade_no;
           return CommonController::success("成功！", $data['data']);

       }
    }

    public function payCallbackUrl(){

    }
}